home *** CD-ROM | disk | FTP | other *** search
- class smashing.Menu extends MovieClip
- {
- var startTime;
- var limit;
- var onEnterFrame;
- static var target;
- var bEnabled = true;
- function Menu()
- {
- super();
- smashing.Menu.target = this;
- }
- function onShow()
- {
- }
- function onResume()
- {
- }
- function show(sFrame)
- {
- this.onShow();
- this.gotoAndPlay(sFrame);
- }
- function resume()
- {
- this.gotoAndStop("blank");
- this.onResume();
- }
- function playAgain()
- {
- }
- static function watchProp(o, sProp, sType)
- {
- switch(sType)
- {
- case "text":
- o.watch(sProp,smashing.Menu.watchText);
- break;
- case "frameMeter":
- o.watch(sProp,smashing.Menu.watchFrameMeter);
- break;
- case "pegboard":
- o.watch(sProp,smashing.Menu.watchPegboard);
- break;
- case "signboard":
- o.watch(sProp,smashing.Menu.watchSignboard);
- break;
- case "singleDigit":
- o.watch(sProp,smashing.Menu.watchSingleDigit);
- break;
- case "funkyMeter":
- o.watch(sProp,smashing.Menu.watchFunkyMeter);
- }
- }
- static function watchText(prop, oldVal, newVal)
- {
- smashing.Menu.target[prop.toString()] = newVal;
- return newVal;
- }
- static function watchFrameMeter(prop, oldVal, newVal)
- {
- var _loc2_ = smashing.Menu.target[prop.toString()];
- var _loc1_ = Math.ceil(newVal * _loc2_._totalframes);
- if(_loc1_ == 0)
- {
- _loc1_ = 1;
- }
- _loc2_.gotoAndStop(_loc1_);
- return newVal;
- }
- static function watchPegboard(prop, oldVal, newVal)
- {
- var _loc1_ = smashing.Menu.target[prop.toString()];
- _loc1_.pegs = newVal;
- return newVal;
- }
- static function watchSignboard(prop, oldVal, newVal)
- {
- var _loc4_ = 1;
- var _loc2_ = smashing.Menu.target[prop.toString()];
- _loc2_.gotoAndStop(newVal);
- _loc2_.startTime = getTimer();
- _loc2_.limit = _loc4_;
- _loc2_.onEnterFrame = function()
- {
- var _loc2_ = (getTimer() - this.startTime) / 1000;
- if(_loc2_ >= this.limit)
- {
- this._visible = false;
- delete this.onEnterFrame;
- }
- };
- return newVal;
- }
- static function watchSingleDigit(prop, oldVal, newVal)
- {
- var _loc1_ = smashing.Menu.target[prop.toString()];
- _loc1_.gotoAndStop(newVal + 1);
- smashing.Menu.target[prop + "cache"] = newVal + 1;
- return newVal;
- }
- static function watchFunkyMeter(prop, oldVal, newVal)
- {
- if(newVal < 0)
- {
- newVal = 0;
- }
- var _loc2_ = smashing.Menu.target.funkyMeter;
- var _loc1_ = _loc2_[prop.toString()];
- var _loc4_ = _loc2_[prop.toString() + "Cap"];
- _loc1_._width = newVal * _loc1_.fullWidth;
- _loc4_._x = _loc1_._x + _loc1_._width - _loc4_._width / 2;
- _loc2_[prop.toString() + "Cache"] = newVal;
- return newVal;
- }
- }
-